import java.util.Random;
import java.util.Scanner;

public class guessnumber {
    public static void main(String[] args) {
//        猜数字
        Random random = new Random();
        int ansnum= random.nextInt(100)+1;
        Scanner scanner =new Scanner(System.in);
        while(true) {
            System.out.println("请输入一个1——100之间的整数:");
            int num= scanner.nextInt();
            if(num>ansnum){
                System.out.println("猜大了");
            } else if (num<ansnum) {
                System.out.println("猜小了");
            }else{
                System.out.println("猜对了");
                break;

            }
        }

    }
}
